package chap8;
//************************************************************************
//  PP8_1.java                      Author:GK
//
//  读取 0~50 任意多整数，计算每项输入数据出现的次数，用一个范围外的值
//  表明结束。
//************************************************************************
import java.util.Scanner;

public class PP8_1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int[] numbers = new int[51];
        int index = 0;

        System.out.print("请输入0~50间整数： ");

        while (index<=50 && index>=0)
        {
            index = scan.nextInt();

            for (int x = 0; x < 50; x++)
            {
                if(index == x)
                    numbers[index]++;
            }
        }
        System.out.println();
        for (int num = 0; num < numbers.length; num++)
        {
            System.out.print(num);
            System.out.println(": " + numbers[num]);
        }

    }

}
